/* PROJECT ETERNAL - SOURCE CODE
 * RELEASED UNDER GNU GPL v3
 * 
 * A STUDENT WRITTEN OPEN SOURCE SIDE SCROLLING VIDEO GAME
 * 
 */

//CHANGE LOG
/* 2.20.12 - CREATED PROJECT - RUNS - BACON
 * 2.20.12 - ADDED MAIN CLASS, CHANGED GAME1.CS TO GAME.CS - RUNS - BACON
 * 2.21.12 - ADDED ENTITY, DRAWABLE OBJECT, LEVEL, NPC, PLAYER, TILE CLASSES - RUNS - BACON
 * 
 */

/*
 * 
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace ETERNAL
{
    public class Game : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        
        private Level level;
        public Rectangle screenBounds;
        private const int WINDOW_WIDTH = 500;
        private const int WINDOW_HEIGHT = 500;

        public Game()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            screenBounds = new Rectangle(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
        }

        protected override void Initialize()
        {
            //Anything to do with setting up the game
            Window.Title = "PROJECT ETERNAL INTERNAL DEVELOPMENT RELEASE";
            Window.AllowUserResizing = false;
            IsMouseVisible = true;
            graphics.PreferredBackBufferWidth = WINDOW_WIDTH;
            graphics.PreferredBackBufferHeight = WINDOW_HEIGHT;
            graphics.ApplyChanges();

            base.Initialize();
        }

        protected override void LoadContent()
        {
            level = new Level();
            level.LoadContent(Content);
            spriteBatch = new SpriteBatch(GraphicsDevice);
        }

        protected override void UnloadContent()
        {
        }

        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                this.Exit();
            base.Update(gameTime);
            level.Update();
        }
        protected override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();
            GraphicsDevice.Clear(Color.Black);
            base.Draw(gameTime);
            level.DrawLevel(spriteBatch);
            spriteBatch.End();
        }
    }
}
